import OSS from 'ali-oss';
import request from '@/utils/request.js';
import { getUser, setUser, clearUser, getOrg, setOrg, clearOrg } from '@/utils/auth';

let config = {
	accessKeyId: 'LTAI4FwuaEhD31CFftxKXZE2',
	accessKeySecret: 'zQ8cDU6vxf9LJTFCTVgM9A0OVgZaqe',
	bucket: 'pointcircle-estate',
	region: 'oss-cn-chengdu'
}
let client = new OSS(config);

export const upload = (path, file) => {
	return client.put(getOrg().id + "/" + path, file);
}

export const uploadImage = (filename, file) => {
	let path = "image/" + filename;
	return upload(path, file);
}